import { Component, OnInit } from '@angular/core';
import { NzMessageService, NzModalService } from 'ng-zorro-antd';
import { ApiService } from 'src/app/core/api';
import { FormBuilder, Validators } from '@angular/forms';
import { Router, ActivatedRoute } from '@angular/router';
import { MessageService } from 'src/app/core/service/message.service';
import { I18nService } from 'src/app/core/i18n/i18n.service';

@Component({
	templateUrl: './USDTAddress.html',
})
export class USDTAddressComponent implements OnInit {
	address;
	constructor(private i18n:I18nService ,private message:MessageService ,private apiService: ApiService, private nzMessageService: NzMessageService, private fb: FormBuilder, private router: Router) {
		this.i18n.get('pagetitle').subscribe(res=>{
            const pagetitle = res;
            this.message.setBreadcrumb({
                breadcrumbs: [{ name: pagetitle.title8}],
            });
        })
	}
	ngOnInit() {
		this.apiService.post('获取平台收款地址',{}).then((res:any)=>{
			this.address = res.data.address;
		})
	}
	submit() {
		if(this.address){
			this.apiService.post('修改平台收款地址',{address:this.address}).then((res:any)=>{
				this.nzMessageService.success('USDT收款地址保存成功！');
			})
		}else{
			this.nzMessageService.warning('请输入平台USDT收款地址');
		}
	}
}
